/*
 * This class was automatically generated with 
 * <a href="http://www.castor.org">Castor 1.3</a>, using an XML
 * Schema.
 * $Id$
 */

package nl.biggrid.plier.opm;

import java.util.LinkedHashSet;
import javax.jdo.annotations.PersistenceCapable;
/**
 * This class represents an OPM agent entity (i.e a contextual entity acting as a catalyst of a process, enabling, facilitating,
controlling, affecting its execution).
 * 
 * @version $Revision$ $Date$
 */
@SuppressWarnings("serial")
@PersistenceCapable
public class Agent implements java.io.Serializable {


      //--------------------------/
     //- Class/Member Variables -/
    //--------------------------/

    /**
     * Field id.
     */
    private java.lang.String id;

    /**
     * Field value.
     */
    private java.lang.String value;

    /**
     * Field graph.
     */
    private OPMGraph graph;

    /**
     * Field accounts.
     */
    private LinkedHashSet<Account> accounts;

      //----------------/
     //- Constructors -/
    //----------------/
    /**
     * Class constructor.
     */
    public Agent() {
        super();
        accounts = new LinkedHashSet<Account>();
    }


      //-----------/
     //- Methods -/
    //-----------/

    /**
     * Returns the OPM ID of this agent.
     *
     * @return The OPM ID of this agent.
     */
    public java.lang.String getId(
    ) {
        return this.id;
    }


    /**
     * Returns the value of this agent.
     *
     * @return the value of this agent.
     */
    public java.lang.String getValue(
    ) {
        return this.value;
    }

    /**
     * Sets the OPM ID of this agent.
     *
     * @param id the OPM ID of this agent.
     */
    public void setId(
            final java.lang.String id) {
        this.id = id;
    }

    /**
     * Sets the OPM value of this agent.
     *
     * @param value The OPM value of this agent.
     */
    public void setValue(
            final java.lang.String value) {
        this.value = value;
    }

    /**
     * Sets the OPM graph this agent is part of.
     *
     * @param graph the value of the OPM graph.
     */
    public void setGraph(OPMGraph graph) {
        this.graph = graph;
    }

    /**
     * Returns the value of field 'graph'.
     *
     * @return the value of field 'graph'.
     */
    public OPMGraph getGraph() {
        return graph;
    }

    /**
     * Returns the contents of the
     * collection in a Vector.
     *
     * @return this collection as a Vector
     */
    public LinkedHashSet<Account> getAccounts() {
        return this.accounts;
    }

     /**
     * Sets the account list from a vector.
     *
     * @param vRelatedAccountArray The vector to set the account list from.
     */
    public void setAccounts(
            final LinkedHashSet<Account> vRelatedAccountArray) {
        //-- copy array
        this.accounts.clear();
        this.accounts = vRelatedAccountArray;
    }

    /**
     * Adds an account to the list of accounts this agent belongs to.
     *
     * @param vRelatedAccount The account to add as an ID.
     * @throws java.lang.IndexOutOfBoundsException if the index
     * given is outside the bounds of the collection
     */
    public void addAccount(final Account anAccount) {
        this.accounts.add(anAccount);
    }

}
